﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Diagnostics;

namespace StarfleetCommanderDomain.Game
{
    [DebuggerDisplay("\\{ Name = {Name}, Level = {Level} \\}")]
    public class Building : IEquatable<Building>
    {
        private readonly string _Name;
        private readonly byte _Level;

        public Building(string name, byte level)
        {
            _Name = name;
            _Level = level;
        }

        public override bool Equals(object obj)
        {
            if (obj is Building)
                return Equals((Building)obj);
            return false;
        }
        public bool Equals(Building obj)
        {
            if (obj == null)
                return false;
            if (!EqualityComparer<string>.Default.Equals(_Name, obj._Name))
                return false;
            if (!EqualityComparer<byte>.Default.Equals(_Level, obj._Level))
                return false;
            return true;
        }
        public override int GetHashCode()
        {
            int hash = 0;
            hash ^= EqualityComparer<string>.Default.GetHashCode(_Name);
            hash ^= EqualityComparer<byte>.Default.GetHashCode(_Level);
            return hash;
        }
        public override string ToString()
        {
            return String.Format("{{ Name = {0}, Level = {1} }}", _Name, _Level);
        }

        public string Name
        {
            get
            {
                return _Name;
            }
        }
        public byte Level
        {
            get
            {
                return _Level;
            }
        }
    }

}